package com.ulife.order.api.response;

import com.ulife.common.gateway.utils.annotation.Description;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by Ulife- dang 2015/12/30.
 */
@Description("订单信息")
public class SaleOrderInfo implements Serializable {
    @Description("订单编号")
    public String saleNo;
    @Description("订单日期")
    public long orderTime;
    @Description("配送日期")
    public long shipDate;
    @Description("订单分类")
    public String orderCategory;
    @Description("订单团购ID")
    public long groupId;
    @Description("商品总金额")
    public double subAmount;
    @Description("优惠费用")
    public double promotionDiscount;
    @Description("优惠券商品优惠费用")
    public double productCouponDiscount;
    @Description("运费")
    public double shipFee;
    @Description("运费折扣")
    public double shipFeeDiscount;
    @Description("优惠券运费折扣")
    public double shipFeeCouponDiscount;
    @Description("订单总金额")
    public double totalAmount;
    @Description("支付金额")
    public double paidAmount;
    @Description("待支付金额")
    public double waitPaidAmount;
    @Description("包裹数量")
    public int shipmentCount;
    @Description("商品数量")
    public int productCount;
    @Description("订单状态")
    public int status;
    @Description("订单中文状态")
    public String statusValue;
    @Description("支付状态")
    public int payStatus;
    @Description("支付类型")
    public String payType;
    @Description("地址信息")
    public AddressInfo address;
    @Description("商品信息")
    public List<ItemInfo> items;
    @Description("订单创建人")
    public String createdBy;

    @Description("支付渠道")
    public String payChannel;

    //-----------------------------其他信息---------------------------------
    @Description("支付倒计时")   //用处： 订单列表页
    public long exceedTime;
    @Description("最后一条物流信息") //用处： 订单详情页
    public String lastTracking;
    @Description("商品分组信息") //用处： 订单详情页
    public List<ItemGroupInfo> groups;
    @Description("包裹信息")  //用处： 订单详情页
    public List<ShipmentInfo> shipments;
    @Description("支付操作code  可支付：CanPay  部分支付： PartialPay 不可支付：CannotPay")  //用处： 订单详情页,列表页
    public String  payActionCode;
    @Description("取消操作code  可取消：CanCancel   不可取消： CannotCancel；可取消并退款：CanPayCancel")  //用处： 订单详情页，列表页
    public String cancelActionCode;

    @Description("是否支持部分余额支付退款；可取消并退款：CanPayCancel；不可取消并退款：CannotPayCancel（暂时不用）")
    public String refundPartialPayActionCode;

    //-------------------------------虚拟商品信息--------------------------------------------
    @Description("虚拟商品信息")
    public List<VirtualProductInfo> virtualProductInfos;

    public List<VirtualProductInfo> getVirtualProductInfos() {
        return virtualProductInfos;
    }

    public void setVirtualProductInfos(List<VirtualProductInfo> virtualProductInfos) {
        this.virtualProductInfos = virtualProductInfos;
    }

    public String getOrderCategory() {
        return orderCategory;
    }

    public void setOrderCategory(String orderCategory) {
        this.orderCategory = orderCategory;
    }

    public long getGroupId() {
        return groupId;
    }

    public void setGroupId(long groupId) {
        this.groupId = groupId;
    }

    public String getSaleNo() {
        return saleNo;
    }

    public void setSaleNo(String saleNo) {
        this.saleNo = saleNo;
    }

    public long getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(long orderTime) {
        this.orderTime = orderTime;
    }

    public long getShipDate() {
        return shipDate;
    }

    public void setShipDate(long shipDate) {
        this.shipDate = shipDate;
    }

    public double getSubAmount() {
        return formatFloat(subAmount);
    }

    public void setSubAmount(double subAmount) {
        this.subAmount = subAmount;
    }

    public double getPromotionDiscount() {
        return formatFloat(promotionDiscount);
    }

    public void setPromotionDiscount(double promotionDiscount) {
        this.promotionDiscount = promotionDiscount;
    }

    public double getProductCouponDiscount() {
        return productCouponDiscount;
    }

    public void setProductCouponDiscount(double productCouponDiscount) {
        this.productCouponDiscount = productCouponDiscount;
    }

    public double getShipFee() {
        return formatFloat(shipFee);
    }

    public void setShipFee(double shipFee) {
        this.shipFee = shipFee;
    }

    public double getShipFeeDiscount() {
        return formatFloat(shipFeeDiscount);
    }

    public void setShipFeeDiscount(double shipFeeDiscount) {
        this.shipFeeDiscount = shipFeeDiscount;
    }

    public double getShipFeeCouponDiscount() {
        return formatFloat(shipFeeCouponDiscount);
    }

    public void setShipFeeCouponDiscount(double shipFeeCouponDiscount) {
        this.shipFeeCouponDiscount = shipFeeCouponDiscount;
    }

    public double getTotalAmount() {
        return formatFloat(totalAmount);
    }

    public void setTotalAmount(double totalAmount) {
        this.totalAmount = totalAmount;
    }

    public double getPaidAmount() {
        return formatFloat(paidAmount);
    }

    public void setPaidAmount(double paidAmount) {
        this.paidAmount = paidAmount;
    }

    public double getWaitPaidAmount() {
        return formatFloat(waitPaidAmount);
    }

    public void setWaitPaidAmount(double waitPaidAmount) {
        this.waitPaidAmount = waitPaidAmount;
    }

    public int getShipmentCount() {
        return shipmentCount;
    }

    public void setShipmentCount(int shipmentCount) {
        this.shipmentCount = shipmentCount;
    }

    public int getProductCount() {
        return productCount;
    }

    public void setProductCount(int productCount) {
        this.productCount = productCount;
    }

    public String getStatusValue() {
        return statusValue;
    }

    public void setStatusValue(String statusValue) {
        this.statusValue = statusValue;
    }

    public int getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(int payStatus) {
        this.payStatus = payStatus;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public AddressInfo getAddress() {
        return address;
    }

    public void setAddress(AddressInfo address) {
        this.address = address;
    }

    public List<ItemInfo> getItems() {
        return items;
    }

    public void setItems(List<ItemInfo> items) {
        this.items = items;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public long getExceedTime() {
        return exceedTime;
    }

    public void setExceedTime(long exceedTime) {
        this.exceedTime = exceedTime;
    }

    public String getLastTracking() {
        return lastTracking;
    }

    public void setLastTracking(String lastTracking) {
        this.lastTracking = lastTracking;
    }

    public List<ItemGroupInfo> getGroups() {
        return groups;
    }

    public void setGroups(List<ItemGroupInfo> groups) {
        this.groups = groups;
    }

    public List<ShipmentInfo> getShipments() {
        return shipments;
    }

    public void setShipments(List<ShipmentInfo> shipments) {
        this.shipments = shipments;
    }


    public String getPayActionCode() {
        return payActionCode;
    }

    public void setPayActionCode(String payActionCode) {
        this.payActionCode = payActionCode;
    }

    public String getCancelActionCode() {
        return cancelActionCode;
    }
    public void setCancelActionCode(String cancelActionCode) {
        this.cancelActionCode = cancelActionCode;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    private double formatFloat(double x){
        return   new Double(new DecimalFormat("###0.00").format(x));
    }

    /**
     *  获取部分支付取消并退款状态
     * @return
     */
    public String getRefundPartialPayActionCode() {
        return refundPartialPayActionCode;
    }

    /**
     * 部分支付取消并退款状态
     * @param refundPartialPay
     */
    public void setRefundPartialPayActionCode(String refundPartialPay) {
        this.refundPartialPayActionCode = refundPartialPay;
    }

    /**
     * 支付渠道
     * @return 常见渠道：“支付宝”，“微信”，“翼支付”....
     */
    public String getPayChannel() {
        return payChannel;
    }

    /**
     * 支付渠道<br />
     * 常见渠道：“支付宝”，“微信”，“翼支付”....
     */
    public void setPayChannel(String payChannel) {
        this.payChannel = payChannel;
    }
}